Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TW-1570 Implement hiding 'All Networks' option #1220

Closed

Conversation

keshan3262
Copy link
Collaborator

No description provided.

@keshan3262 keshan3262 self-assigned this Nov 5, 2024
@keshan3262 keshan3262 marked this pull request as ready for review November 5, 2024 07:52
Comment on lines +3 to +15
type SearchNetwork = string | { name: string };

export const searchNetworksByName = <T extends SearchNetwork>(networks: T[], searchValue: string) => {
const preparedSearchValue = searchValue.trim().toLowerCase();

return preparedSearchValue
? searchAndFilterItems(
networks.filter(network => typeof network !== 'string'),
preparedSearchValue,
[{ name: 'name', weight: 1 }]
)
: networks;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to search by that 'all networks' string, as dictated by the task requirements.

+ I18N:

export function searchAndFilterChains(networks: OneOfChains[], searchValue: string) {
  return searchAndFilterItems(
    networks,
    searchValue.trim(),
    [
      { name: 'name', weight: 1 },
      { name: 'nameI18n', weight: 1 }
    ],
    ({ name, nameI18nKey }) => ({
      name,
      nameI18n: nameI18nKey ? t(nameI18nKey) : undefined
    })
  );
}

See implementation here: https://github.com/madfish-solutions/templewallet-extension/blob/TW-1479-evm-transactions-history/src/lib/ui/search-networks.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants